home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / UGPRG.ZIP / DENTHOR / TUT15.DOC < prev    next >
Encoding:
Text File  |  1996-07-27  |  19.5 KB  |  586 lines

  1.                    ╒═══════════════════════════════╕
  2.                    │         W E L C O M E         │
  3.                    │  To the VGA Trainer Program   │ │
  4.                    │              By               │ │
  5.                    │      DENTHOR of ASPHYXIA      │ │ │
  6.                    ╘═══════════════════════════════╛ │ │
  7.                      ────────────────────────────────┘ │
  8.                        ────────────────────────────────┘
  9.  
  10.                            --==[ PART 15 ]==--
  11.  
  12.  
  13.  
  14. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. ■ Introduction
  16.  
  17. Hello again. As you can see, this tut is very soon after the last one.
  18. This is because of two reasons ... 1) The PCGPE ][ will be out soon, so
  19. I thought I would make sure I have more then just four new trainers for it,
  20. and 2) I am usually so late between tuts, I thought I would make up for it.
  21.  
  22. There is a discussion going on in Usenet, mostly saying that trainers etc.
  23. should be written a bit more formally and none of this gay banter and
  24. familiar language should be used. My "quotes" would definately be out ;-)
  25. But, until I get paid for doing this (and there don't seem to be any takers
  26. on that score), I will continue to write in this manner. My apologies to those
  27. who dont like this, but hey, its free, what did you expect?
  28.  
  29. This trainer is on plasmas, and the sample program actually became quite large,
  30. mostly due to the fact that there was some plasma stuff I wanted to try out.
  31.  
  32. The concept is very simple, at least for this plasma, so you shouldn't have
  33. any problems understanding it ... AFTER you have read the text file ...
  34. jumping straight into the source may be hazardous to your brain.
  35.  
  36. Plasmas are a great way to wow your friends by their wierd shapes and forms.
  37. I was at one stage going to write a game where the bad guy just had two
  38. circular plasmas instead of eyes... I am sure you will find creative and
  39. inventive new ways of doing and using plasmas.
  40.  
  41.  
  42. If you would like to contact me, or the team, there are many ways you
  43. can do it : 1) Write a message to Grant Smith/Denthor/Asphyxia in private mail
  44.                   on the ASPHYXIA BBS.
  45.             2) Write to :  Grant Smith
  46.                            P.O.Box 270 Kloof
  47.                            3640
  48.                            Natal
  49.                            South Africa
  50.             3) Call me (Grant Smith) at (031) 73 2129 (leave a message if you
  51.                   call during varsity). Call +27-31-73-2129 if you call
  52.                   from outside South Africa. (It's YOUR phone bill ;-))
  53.             4) Write to denthor@beastie.cs.und.ac.za in E-Mail.
  54.             5) Write to asphyxia@beastie.cs.und.ac.za to get to all of
  55.                us at once.
  56.  
  57. NB : If you are a representative of a company or BBS, and want ASPHYXIA
  58.        to do you a demo, leave mail to me; we can discuss it.
  59. NNB : If you have done/attempted a demo, SEND IT TO ME! We are feeling
  60.         quite lonely and want to meet/help out/exchange code with other demo
  61.         groups. What do you have to lose? Leave a message here and we can work
  62.         out how to transfer it. We really want to hear from you!
  63.  
  64.  
  65.  
  66. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  67. ■  How do plasmas work?
  68.  
  69. I will only cover one type of plasma here ... a realtime plasma of course.
  70. Other types of plasmas include a static picture with a pallette rotation...
  71.  
  72. When you get right down to it, this method of realtime plasmas is merely an
  73. intersection of four COS waves. We get our color at a particular point by
  74. saying :
  75.       col := costbl[one]+costbl[two]+costbl[three]+costbl[four];
  76.  
  77. The trick is getting the four indexes of that cos table array to create
  78. something that looks nice. This is how we organise it : Have two of them
  79. being indexes for vertical movement and two of them being indexes for
  80. horizontal movement.
  81.  
  82. This means that by changing these values we can move along the plasma. To
  83. draw an individual screen, we pass the values of the four to another four
  84. so that we do not disturb the origional values. For every pixel across, we
  85. add values to the first two indexes, then display the next pixel. For
  86. every row down, we add values to the second two indexes. Sound complex
  87. enough? Good, because that what we want, a complex shape on the screen.
  88.  
  89. By altering the origional four values, we can get all sorts of cool movement
  90. and cycling of the plasma. The reason we use a cos table is as follows :
  91. a cos table has a nice curve in the value of the numbers ... when you
  92. put two or more together, it is possible to get circular pictures ...
  93. circles are hard to do on a computer, so this makes it a lot easier...
  94.  
  95. Okay, now you can have a look at the source file, all I do is put the above
  96. into practice. I did add one or two things though ...
  97.  
  98. Background : This is just a large array, with the values in the array being
  99. added to the plasma at that pixel.
  100.  
  101. Psychadelic : This cycles through about 7000 colors instead of just rotating
  102. through the base 256.
  103.  
  104.  
  105. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  106. ■  Clever fading
  107.  
  108. You will notice when the sample program fades in and out that the colors
  109. all reach their destination at the same time ... it other words, they don't
  110. all increment by one until they hit the right color then stop. When done
  111. in that way the fading does not look as professional.
  112.  
  113. Here is how we do a step-crossfade.
  114.  
  115. Each r,g,b value can be between 0 and 64. Have the pallette we want to get
  116. to in bob and the temporary pallette in bob2. For each step, from 0 to 63
  117. do the following :
  118.      bob2[loop1].r:=bob[loop1].r*step/64;
  119.  
  120. That means if we are halfway through the crossfade (step=32) and the red
  121. value is meant to get to 16, our equation looks like this :
  122.     r:=16*32/64
  123.      r=8
  124.  
  125. Which is half of the way to where it wants to be. This means all colors will
  126. fade in/out with the same ratios... and look nicer.
  127.  
  128.  
  129. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  130. ■  Rotating the pallette
  131.  
  132. I have done this one before I think .. here it is ...
  133.  
  134. move color 0 into temp
  135.  
  136. move color 1 into color 0
  137. move color 2 into color 1
  138. move color 3 into color 2
  139. and so on till color 255
  140.  
  141. move temp into color 255
  142.  
  143. And you pallette is rotating. Easy huh? Recheck tut 2 for more info on
  144. pallette rotation
  145.  
  146. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  147. ■  In closing
  148.  
  149. The text file was a bit short this time, but that is mostly because the
  150. sample file is self explanitory. The file can however be speeded up, and
  151. of course you can add certain things which will totally change the look
  152. of the plasma.
  153.  
  154. As always, I am on the lookout for more ideas for future tuts, if you have
  155. some, mail me!
  156.  
  157. No quote today, this lan doesn't encourage creative thinking ;) However,
  158. there will be quotes in future as I have been told that some people like
  159. them. Even Pipsy said this while we were playing Ctrl-Alt-Del (two player
  160. game, one has to hit ctrl and alt as the other hits del, and the person
  161. hitting the del has to do it quickly so that the computer doesnt reboot.
  162. If the computer reboots the person who was hitting ctrl and alt has won.
  163. I thought I was doing really badly against Pipsy until I found out that the
  164. computer had frozen ;-))
  165.  
  166. Byeeee....
  167.   - Denthor
  168.       14:11
  169.         16-9-94
  170.  
  171.  
  172. The following are official ASPHYXIA distribution sites :
  173.  
  174. ╔══════════════════════════╦════════════════╦═════╗
  175. ║BBS Name                  ║Telephone No.   ║Open ║
  176. ╠══════════════════════════╬════════════════╬═════╣
  177. ║ASPHYXIA BBS #1           ║+27-31-765-5312 ║ALL  ║
  178. ║ASPHYXIA BBS #2           ║+27-31-765-6293 ║ALL  ║
  179. ║C-Spam BBS                ║410-531-5886    ║ALL  ║
  180. ║POP!                      ║+27-12-661-1257 ║ALL  ║
  181. ║Soul Asylum               ║+358-0-5055041  ║ALL  ║
  182. ║Wasted Image              ║407-838-4525    ║ALL  ║
  183. ╚══════════════════════════╩════════════════╩═════╝
  184.  
  185. Leave me mail if you want to become an official Asphyxia BBS
  186. distribution site.
  187. {$X+}
  188. USES crt;
  189.  
  190. TYPE RGBType = Record
  191.                R, G, B : Byte;
  192.             End;
  193.      PalType = Array[0..255] of RGBType;
  194.  
  195. VAR bob,bob2:paltype;  { Two pallettes, current and temporary }
  196.     biiiigpallette : array [1..6656] of RGBType; { A massive pallette for the
  197.                                                    psychadelic effect }
  198.     start:integer;  { Where in the Biiiig pallette are we? }
  199.     Effect,Background:Boolean; { Configuration of effects }
  200.  
  201.     costbl : Array [0..255] of byte; { cos table lookup }
  202.     mov1,mov2,mov3,mov4 : byte;  { current positions }
  203.     bkg : array [1..50,1..80] of byte; { The pic in the background }
  204.  
  205.  
  206.  
  207. {──────────────────────────────────────────────────────────────────────────}
  208. procedure PAL(Col,R,G,B : Byte); assembler;
  209.    { This sets the Red, Green and Blue values of a certain color }
  210. asm
  211.    mov    dx,3c8h
  212.    mov    al,[col]
  213.    out    dx,al
  214.    inc    dx
  215.    mov    al,[r]
  216.    out    dx,al
  217.    mov    al,[g]
  218.    out    dx,al
  219.    mov    al,[b]
  220.    out    dx,al
  221. end;
  222.  
  223. {──────────────────────────────────────────────────────────────────────────}
  224. Procedure SetAllPal(Var Palette : PalType); Assembler;
  225.   { This dumps the pallette in our variable onto the screen, fast }
  226. Asm
  227.    push   ds
  228.    lds    si, Palette
  229.    mov    dx, 3c8h
  230.    mov    al, 0
  231.    out    dx, al
  232.    inc    dx
  233.    mov    cx, 768
  234.    rep    outsb
  235.    pop    ds
  236. End;
  237.  
  238. {──────────────────────────────────────────────────────────────────────────}
  239. Procedure Makerun (r,g,b:integer);
  240.   { This creates a ramp of colors and puts them into biiiigpallette }
  241. VAR loop1:integer;
  242. BEGIN
  243.   for loop1:=start to start+127 do BEGIN
  244.     if r=1 then
  245.       biiiigpallette[loop1].r:=63-(loop1-start) div 4 else
  246.     if r=2 then
  247.       biiiigpallette[loop1].r:=(loop1-start) div 4 else
  248.       biiiigpallette[loop1].r:=0;
  249.  
  250.     if g=1 then
  251.       biiiigpallette[loop1].g:=63-(loop1-start) div 4 else
  252.     if g=2 then
  253.       biiiigpallette[loop1].g:=(loop1-start) div 4 else
  254.       biiiigpallette[loop1].g:=0;
  255.  
  256.     if b=1 then
  257.       biiiigpallette[loop1].b:=63-(loop1-start) div 4 else
  258.     if b=2 then
  259.       biiiigpallette[loop1].b:=(loop1-start) div 4 else
  260.       biiiigpallette[loop1].b:=0;
  261.   END;
  262.  
  263.   for loop1:=start+128 to start+255 do BEGIN
  264.     if r=2 then
  265.       biiiigpallette[loop1].r:=63-(loop1-start) div 4 else
  266.     if r=1 then
  267.       biiiigpallette[loop1].r:=(loop1-start) div 4 else
  268.       biiiigpallette[loop1].r:=0;
  269.  
  270.     if g=2 then
  271.       biiiigpallette[loop1].g:=63-(loop1-start) div 4 else
  272.     if g=1 then
  273.       biiiigpallette[loop1].g:=(loop1-start) div 4 else
  274.       biiiigpallette[loop1].g:=0;
  275.  
  276.     if b=2 then
  277.       biiiigpallette[loop1].b:=63-(loop1-start) div 4 else
  278.     if b=1 then
  279.       biiiigpallette[loop1].b:=(loop1-start) div 4 else
  280.       biiiigpallette[loop1].b:=0;
  281.   END;
  282.   start:=start+256;
  283. END;
  284.  
  285.  
  286. {──────────────────────────────────────────────────────────────────────────}
  287. Procedure init;
  288. VAR loop1,loop2,r,g,b:integer;
  289.     f:text;
  290.     ch:char;
  291.  
  292.   Function rad (theta : real) : real; { Converts degrees to radians }
  293.   BEGIN
  294.     rad := theta * pi / 180
  295.   END;
  296.  
  297. BEGIN
  298.   write ('Do you want the Psychadelic effect? ');
  299.   repeat
  300.     ch:=upcase(readkey);
  301.   until ch in ['Y','N'];
  302.   if ch='Y' then BEGIN
  303.     Writeln ('Yeah!');
  304.     effect:=true;
  305.   END else BEGIN
  306.     Writeln ('Nah');
  307.     effect:=false;
  308.   END;
  309.   writeln;
  310.   while keypressed do readkey;
  311.   write ('Do you want the background? ');
  312.   repeat
  313.     ch:=upcase(readkey);
  314.   until ch in ['Y','N'];
  315.   if ch='Y' then BEGIN
  316.     Writeln ('Yeah!');
  317.     background:=true;
  318.   END else BEGIN
  319.     Writeln ('Nah');
  320.     background:=false;
  321.   END;
  322.   writeln;
  323.   while keypressed do readkey;
  324.   writeln ('Hit any key to continue...');
  325.   readkey;
  326.   while keypressed do readkey;
  327.   asm
  328.     mov     ax,0013h
  329.     int     10h                     { Enter mode 13 }
  330.     cli
  331.     mov     dx,3c4h
  332.     mov     ax,604h                 { Enter unchained mode }
  333.     out     dx,ax
  334.     mov     ax,0F02h                { All planes}
  335.     out     dx,ax
  336.  
  337.     mov     dx,3D4h
  338.     mov     ax,14h                  { Disable dword mode}
  339.     out     dx,ax
  340.     mov     ax,0E317h               { Enable byte mode.}
  341.     out     dx,ax
  342.     mov     al,9
  343.     out     dx,al
  344.     inc     dx
  345.     in      al,dx
  346.     and     al,0E0h                 { Duplicate each scan 8 times.}
  347.     add     al,7
  348.     out     dx,al
  349.   end;
  350.  
  351.   fillchar (bob2,sizeof(bob2),0);  { Clear pallette bob2 }
  352.   setallpal (bob2);
  353.  
  354.   start:=0;
  355.   r:=0;
  356.   g:=0;
  357.   b:=0;
  358.   Repeat
  359.     makerun (r,g,b);
  360.     b:=b+1;
  361.     if b=3 then BEGIN
  362.       b:=0;
  363.       g:=g+1;
  364.     END;
  365.     if g=3 then BEGIN
  366.       g:=0;
  367.       r:=r+1;
  368.     END;
  369.   until (r=2) and (g=2) and (b=2);
  370.     { Set up our major run of colors }
  371.  
  372.   start:=0;
  373.   if not effect then BEGIN
  374.     for loop1:=0 to 128 do BEGIN
  375.       bob[loop1].r:=63-loop1 div 4;
  376.       bob[loop1].g:=0;
  377.       bob[loop1].b:=loop1 div 4;
  378.     END;
  379.     for loop1:=129 to 255 do BEGIN
  380.       bob[loop1].r:=loop1 div 4;
  381.       bob[loop1].g:=0;
  382.       bob[loop1].b:=63-loop1 div 4;
  383.     END;
  384.   END else
  385.     for loop1:=0 to 255 do bob[loop1]:=biiiigpallette[loop1];
  386.  
  387.     { Set up a nice looking pallette ... we alter color 0, so the border will
  388.       be altered. }
  389.  
  390.   For loop1:=0 to 255 do
  391.     costbl[loop1]:=round (cos (rad (loop1/360*255*2))*31)+32;
  392.     { Set up our lookup table...}
  393.  
  394.   fillchar (bkg,sizeof(bkg),0);
  395.   assign (f,'a:bkg.dat');
  396.   reset (f);
  397.   for loop1:=1 to 50 do BEGIN
  398.     for loop2:=1 to 80 do BEGIN
  399.       read (f,ch);
  400.       if ord (ch)<>48 then
  401.         bkg[loop1,loop2]:=ord (ch)-28;
  402.     END;
  403.     readln (f);
  404.   END;
  405.   close (f);
  406.     { Here we read in our background from the file bkg.dat }
  407. END;
  408.  
  409.  
  410. {──────────────────────────────────────────────────────────────────────────}
  411. Procedure DrawPlasma;
  412.   { This procedure draws the plasma onto the screen }
  413. VAR loop1,loop2:integer;
  414.     tmov1,tmov2,tmov3,tmov4:byte; { Temporary variables, so we dont destroy
  415.                                     the values of our main variables }
  416.     col:byte;
  417.     where:word;
  418. BEGIN
  419.   tmov3:=mov3;
  420.   tmov4:=mov4;
  421.   where:=0;
  422.   asm
  423.     mov   ax,0a000h
  424.     mov   es,ax        { In the two loops that follow, ES is not altered so
  425.                          we just set it once, now }
  426.   end;
  427.   For loop1:=1 to 50 do BEGIN   { Fifty rows down }
  428.     tmov1:=mov1;
  429.     tmov2:=mov2;
  430.     for loop2:=1 to 80 do BEGIN { Eighty columns across }
  431.       if background then
  432.         col:=costbl[tmov1]+costbl[tmov2]+costbl[tmov3]+costbl[tmov4]+costbl[loop1]+costbl[loop2]+bkg[loop1,loop2]
  433.       else
  434.         col:=costbl[tmov1]+costbl[tmov2]+costbl[tmov3]+costbl[tmov4]+costbl[loop1]+costbl[loop2];
  435.         { col = Intersection of numerous cos waves }
  436.       asm
  437.         mov    di,where   { di is killed elsewhere, so we need to restore it}
  438.         mov    al,col
  439.         mov    es:[di],al { Place col at ES:DI ... sequential across the screen}
  440.       end;
  441.       where:=where+1;  { Inc the place to put the pixel }
  442.       tmov1:=tmov1+4;
  443.       tmov2:=tmov2+3;  { Arb numbers ... replace to zoom in/out }
  444.     END;
  445.     tmov3:=tmov3+4;
  446.     tmov4:=tmov4+5;    { Arb numbers ... replace to zoom in/out }
  447.   END;
  448. END;
  449.  
  450.  
  451. {──────────────────────────────────────────────────────────────────────────}
  452. Procedure MovePlasma;
  453.   { This procedure moves the plasma left/right/up/down }
  454. BEGIN
  455.   mov1:=mov1-4;
  456.   mov3:=mov3+4;
  457.   mov1:=mov1+random (1);
  458.   mov2:=mov2-random (2);
  459.   mov3:=mov3+random (1);
  460.   mov4:=mov4-random (2);   { Movement along the plasma + noise}
  461. END;
  462.  
  463. {──────────────────────────────────────────────────────────────────────────}
  464. procedure WaitRetrace; assembler;
  465.    {  This waits for a vertical retrace to reduce snow on the screen }
  466. label
  467.   l1, l2;
  468. asm
  469.     mov   dx,3DAh
  470. l1:
  471.     in    al,dx
  472.     test  al,8
  473.     jnz   l1
  474. l2:
  475.     in    al,dx
  476.     test  al,8
  477.     jz    l2
  478. end;
  479.  
  480. {──────────────────────────────────────────────────────────────────────────}
  481. Procedure fadeupone (stage:integer);
  482.   { This procedure fades up the pallette bob2 by one increment and sets the
  483.     onscreen pallette. Colors are increased proportionally, do that all colors
  484.     reach their destonation at the same time }
  485. VAR loop1:integer;
  486.     temp:rgbtype;
  487. BEGIN
  488.   if not effect then move (bob[0],temp,3);
  489.   move (bob[1],bob[0],765);
  490.   if effect then move (biiiigpallette[start],bob[255],3) else
  491.     move (temp,bob[255],3);
  492.   start:=start+1;
  493.   if start=6657 then start:=0;
  494.     { Rotate the pallette }
  495.  
  496.   for loop1:=0 to 255 do BEGIN
  497.     bob2[loop1].r:=integer(bob[loop1].r*stage div 64);
  498.     bob2[loop1].g:=integer(bob[loop1].g*stage div 64);
  499.     bob2[loop1].b:=integer(bob[loop1].b*stage div 64);
  500.   END; { Fade up the pallette }
  501.   setallpal (bob2);
  502. END;
  503.  
  504.  
  505. {──────────────────────────────────────────────────────────────────────────}
  506. Procedure Shiftpallette;
  507.   { This rotates the pallette, and introduces new colors if the psychadelic
  508.     effect has been chosen }
  509. VAR loop1:integer;
  510.     temp:rgbtype;
  511. BEGIN
  512.   if not effect then move (bob2[0],temp,3);
  513.   move (bob2[1],bob2[0],765);
  514.   if effect then move (biiiigpallette[start],bob2[255],3) else
  515.     move (temp,bob2[255],3);
  516.   start:=start+1;
  517.   if start=6657 then start:=0;
  518.   setallpal (bob2);
  519. END;
  520.  
  521.  
  522. {──────────────────────────────────────────────────────────────────────────}
  523. Procedure Play;
  524. VAR loop1:integer;
  525. BEGIN
  526.   start:=256;
  527.   for loop1:=1 to 64 do BEGIN
  528.     fadeupone(loop1);
  529.     drawplasma;
  530.     moveplasma;
  531.   END; { Fade up the plasma }
  532.   while keypressed do readkey;
  533.   Repeat
  534.     shiftpallette;
  535.     drawplasma;
  536.     moveplasma;
  537.   Until keypressed; { Do the plasma }
  538.   move (bob2,bob,768);
  539.   for loop1:=1 to 64 do BEGIN
  540.     fadeupone(64-loop1);
  541.     drawplasma;
  542.     moveplasma;
  543.   END; { fade down the plasma }
  544.   while keypressed do readkey;
  545. END;
  546.  
  547. BEGIN
  548.   clrscr;
  549.   writeln ('Hi there ... here is a tut on plasmas! (By popular demand). The');
  550.   writeln ('program will ask you weather you want the Psychadelic effect, in');
  551.   writeln ('which the pallette does strange things (otherwise the pallette');
  552.   writeln ('remains constant), and it will ask weather you want a background');
  553.   writeln ('(a static pic behind the plasma). Try them both!');
  554.   writeln;
  555.   writeln ('The thing about plasmas is that they are very easy to change/modify');
  556.   writeln ('and this one is no exception .. you can even change the background');
  557.   writeln ('with minimum hassle. Try adding and deleting things, you will be');
  558.   writeln ('surprised by the results!');
  559.   writeln;
  560.   writeln ('This is by no means the only way to do plasmas, and there are other');
  561.   writeln ('sample programs out there. Have fun with this one though! ;-)');
  562.   writeln;
  563.   writeln;
  564.   init;
  565.   play;
  566.   asm
  567.     mov  ax,0003h
  568.     int  10h
  569.   end;
  570.   Writeln ('All done. This concludes the fifteenth sample program in the ASPHYXIA');
  571.   Writeln ('Training series. You may reach DENTHOR under the names of GRANT');
  572.   Writeln ('SMITH/DENTHOR/ASPHYXIA on the ASPHYXIA BBS.I also occasinally');
  573.   Writeln ('RSAProg, comp.lang.pascal and comp.sys.ibm.pc.demos. E-mail me at :');
  574.   Writeln ('    denthor@beastie.cs.und.ac.za');
  575.   Writeln ('The numbers are available in the main text. You may also write to me at:');
  576.   Writeln ('             Grant Smith');
  577.   Writeln ('             P.O. Box 270');
  578.   Writeln ('             Kloof');
  579.   Writeln ('             3640');
  580.   Writeln ('             Natal');
  581.   Writeln ('             South Africa');
  582.   Writeln ('I hope to hear from you soon!');
  583.   Writeln; Writeln;
  584.   Write   ('Hit any key to exit ...');
  585.   readkey;
  586. END.